<% if @user && !@user.errors.empty? %>
  <div class="alert alert-danger">
    <h2>There was an error.</h2>

    <h3>Please address the following issues</h3>
    <hr>
    <ul>
      <% @user.errors.each do |attribute, error| %>
        <li class="error_text"><%= attribute.to_s.capitalize %> : <%= error %> </li>
      <% end %>
    </ul>
  </div>
<% end %>

<div id="<%= widget_result_id %>">
  <%= form_remote_tag build_widget_url(:update_password), :class => "form-update_password" do %>
    <div class="form_settings">

      <div class="form-group">
        <label for="password">Enter a password</label>
        <%= password_field_tag :password, nil, :class => "form-control", :placeholder => "", :required => true %>
        <span>Password must be between 8 and 20 characters with no spaces</span>
      </div>

      <div class="form-group">
        <label for="password_confirmation">Confirm your password</label>
        <%= password_field_tag :password_confirmation, nil, :class => "form-control", :placeholder => "", :required => true %>
      </div>

      <p class="text-center">
        <%= submit_tag "Update Password", :disable_with => "Please wait...", :class => "btn btn-primary submit", :style => '' %>
      </p>

      <input type="hidden" value="<%= @token %>" name="token"/>
      <input type="hidden" value="<%= @login_url %>" name="login_url"/>

    </div>
  <% end %>
</div>
